package org.example.smartEducationBackend.controller;

import org.example.smartEducationBackend.entity.POJO.RestResult;
import org.example.smartEducationBackend.service.KafkaProducer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class LogController {

    private final KafkaProducer kafkaProducer;

    public LogController(KafkaProducer kafkaProducer) {
        this.kafkaProducer = kafkaProducer;
    }

    @PostMapping(value = "/logs")
    public RestResult<String> sendMessage(@RequestBody String message) {
        kafkaProducer.sendMessage("user-behavior-topic", message);
        System.out.println(message);

        return RestResult.ok("message");
    }



}
